import java.awt.*;
import java.util.Scanner;

public class 航班时间 {
    static int a;
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();s.nextLine();
        while(n-- >0) {

            a=0;
            String[] s1 = s.nextLine().split(" ");
            String[] s2 = s.nextLine().split(" ");
        if(s1.length==3){
            String[] str = s1[2].split("");
            int extra = Integer.parseInt(str[2]);
            a+=extra*24*3600;
            //System.out.println(extra);
        }
        if(s2.length==3){
            String[] str = s2[2].split("");
            int extra = Integer.parseInt(str[2]);
            //System.out.println(extra);
            a+=extra*24*3600;
        }
            int sum = handle(s1[0],s1[1],s2[0],s2[1]);
            //秒数转时间
            System.out.println(printTime(sum));
        }

    }
    private static String printTime(int time) {
        int h = time/3600;
        int m = (time%3600)/60;
        int s = (time%3600)%60;
        return String.format("%02d:%02d:%02d",h,m,s);
    }
    private static int handle(String t1, String t2,String d1,String d2) {
        int s1 = countTime(t1,t2);
        int s2 = countTime(d1,d2);
        return (s1+s2+a)/2;

    }

    private static int countTime(String t1, String t2) {
        String[] str1 = t1.split(":");
        String[] str2 = t2.split(":");
        int h1 = Integer.parseInt(str1[0]);
        int m1 = Integer.parseInt(str1[1]);
        int s1 = Integer.parseInt(str1[2]);
        int h2 = Integer.parseInt(str2[0]);
        int m2 = Integer.parseInt(str2[1]);
        int s2 = Integer.parseInt(str2[2]);
        int sum1 = h1*3600+m1*60+s1;
        int sum2 = h2*3600+m2*60+s2;
        return  sum2-sum1;
    }

}
